layui.use(['form', 'layedit', 'laydate', 'jquery'], function () {
    var form = layui.form
        , layer = layui.layer
        , $ = layui.$;

    form.render();


    $('#btn').on("click", function () {
        if ($('#userName').val().length > 0 && $("#userPwd").val().length > 0) {
            $.post('/loginOrRegister/check', $('#loginForm').serialize(), function (resp) {
                if (resp.status === 1 || resp.status === 2) {
                    location.href = "/index/index.html"
                } else {
                    layer.msg("账号或密码错误");
                }
            })
        } else {
            layer.msg("账号或密码不能为空");
        }
    })

})

/**
 得到地址栏的参数
 */
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}

